package com.xueyi.system.storeManager.controller;

import com.xueyi.system.storeManager.domain.query.StoreManagerQuery;
import com.xueyi.system.storeManager.domain.dto.StoreManagerDto;
import com.xueyi.system.storeManager.service.IStoreManagerService;
import com.xueyi.common.web.entity.controller.BaseController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xueyi.common.security.annotation.Logical;
import com.xueyi.common.security.annotation.RequiresPermissions;
import com.xueyi.common.core.web.validate.V_A;
import com.xueyi.common.core.web.validate.V_E;
import com.xueyi.common.core.web.result.AjaxResult;
import com.xueyi.common.log.annotation.Log;
import com.xueyi.common.log.enums.BusinessType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.Serializable;
import java.util.List;

/**
 * 储运管理管理 业务处理
 *
 * @author yanhe
 */
@RestController
@RequestMapping("/storeManager")
public class StoreManagerController extends BaseController<StoreManagerQuery, StoreManagerDto, IStoreManagerService> {

    /** 定义节点名称 */
    @Override
    protected String getNodeName() {
        return "储运管理" ;
    }

    /**
     * 查询储运管理列表
     */
    @Override
    @GetMapping("/list")
    @RequiresPermissions(Auth.STORE_MANAGER_LIST)
    public AjaxResult list(StoreManagerQuery storeManager) {
        return super.list(storeManager);
    }

    /**
     * 查询储运管理详细
     */
    @Override
    @GetMapping(value = "/{id}")
    @RequiresPermissions(Auth.STORE_MANAGER_SINGLE)
    public AjaxResult getInfoExtra(@PathVariable Serializable id) {
        return super.getInfoExtra(id);
    }

    /**
     * 储运管理导出
     */
    @Override
    @PostMapping("/export")
    @RequiresPermissions(Auth.STORE_MANAGER_EXPORT)
    @Log(title = "储运管理管理", businessType = BusinessType.EXPORT)
    public void export(HttpServletResponse response, StoreManagerQuery storeManager) {
        super.export(response, storeManager);
    }

    /**
     * 储运管理新增
     */
    @Override
    @PostMapping
    @RequiresPermissions(Auth.STORE_MANAGER_ADD)
    @Log(title = "储运管理管理", businessType = BusinessType.INSERT)
    public AjaxResult add(@Validated({V_A.class}) @RequestBody StoreManagerDto storeManager) {
        return super.add(storeManager);
    }

    /**
     * 储运管理修改
     */
    @Override
    @PutMapping
    @RequiresPermissions(Auth.STORE_MANAGER_EDIT)
    @Log(title = "储运管理管理", businessType = BusinessType.UPDATE)
    public AjaxResult edit(@Validated({V_E.class}) @RequestBody StoreManagerDto storeManager) {
        return super.edit(storeManager);
    }

    /**
     * 储运管理修改状态
     */
    @Override
    @PutMapping("/status")
    @RequiresPermissions(value = {Auth.STORE_MANAGER_EDIT, Auth.STORE_MANAGER_ES}, logical = Logical.OR)
    @Log(title = "储运管理管理", businessType = BusinessType.UPDATE_STATUS)
    public AjaxResult editStatus(@RequestBody StoreManagerDto storeManager) {
        return super.editStatus(storeManager);
    }

    /**
     * 储运管理批量删除
     */
    @Override
    @DeleteMapping("/batch/{idList}")
    @RequiresPermissions(Auth.STORE_MANAGER_DEL)
    @Log(title = "储运管理管理", businessType = BusinessType.DELETE)
    public AjaxResult batchRemove(@PathVariable List<Long> idList) {
        return super.batchRemove(idList);
    }

    /**
     * 获取储运管理选择框列表
     */
    @Override
    @GetMapping("/option")
    public AjaxResult option() {
        return super.option();
    }

    interface Auth {
        /** 系统 - 储运管理管理 - 列表 */
        String STORE_MANAGER_LIST = "system:storeManager:list" ;
        /** 系统 - 储运管理管理 - 详情 */
        String STORE_MANAGER_SINGLE = "system:storeManager:single" ;
        /** 系统 - 储运管理管理 - 新增 */
        String STORE_MANAGER_ADD = "system:storeManager:add" ;
        /** 系统 - 储运管理管理 - 修改 */
        String STORE_MANAGER_EDIT = "system:storeManager:edit" ;
        /** 系统 - 储运管理管理 - 修改状态 */
        String STORE_MANAGER_ES = "system:storeManager:es" ;
        /** 系统 - 储运管理管理 - 删除 */
        String STORE_MANAGER_DEL = "system:storeManager:delete" ;
        /** 系统 - 储运管理管理 - 导出 */
        String STORE_MANAGER_EXPORT = "system:storeManager:export" ;
    }
}
